"""
创建一个名为BankAccount的类，具有以下特征：
属性：account_number（账号），balance（余额)
方法：deposit(amount），用户向账户存款，withdraw(amount),用于从账户取款，get_balance()，用于获取账户余额
操作：实例化对象，存钱和取钱
"""


class BankAccount(object):

    def __init__(self, account_number):
        self.account_number = account_number
        self.balance = 0

    # 获取余额
    def get_balance(self):
        print(f"您的账户{self.account_number}，余额为{self.balance}元")

    # 存钱
    def deposit(self, amount):
        self.balance += amount
        print("存钱成功!")

    # 取钱
    def withdraw(self, amount):
        self.balance -= amount
        print("取钱成功!")


def main(bankaccount_obj):
    while True:
        print("欢迎来到账户系统，请选择你要进行的操作：")
        print("1. 获取余额")
        print("2. 存钱")
        print("3. 取钱")
        print("0. 退出系统")
        print("-------------------")
        op_num = input("请输入你要进行操作的数字:")
        if int(op_num) == 1:
            bankaccount_obj.get_balance()
        elif int(op_num) == 2:
            amount = int(input("请输入你要存钱的金额:"))
            bankaccount_obj.deposit(amount)
        elif int(op_num) == 3:
            amount = int(input("请输入你要提取的金额:"))
            bankaccount_obj.withdraw(amount)
        else:
            exit('本次操作结束。')


if __name__ == "__main__":
    bank_account1 = BankAccount("900323423233")
    main(bank_account1)
